Imports System
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports _2bMatesSite.BO

Namespace _2bMatesSite.Controls


	''' <summary>
	'''		Summary description for GroupBlogTabs.
	''' </summary>
	Public Partial Class GroupBlogTabs
		Inherits System.Web.UI.UserControl

        Private _pageName As String = ""
        Private _activeTab As Integer = -1
		Private grpID As Integer = -1
		Private grp As Group = Nothing
        Private _moderator As Boolean = False

		Public Property PageName() As String
			Get
                Return activeTab
			End Get
			Set
                activeTab = Value
			End Set
		End Property

		Public Property ActiveTab() As Integer
			Get
                Return _activeTab
			End Get
			Set
                _activeTab = Value
			End Set
		End Property

		Public Property Moderator() As Boolean
			Get
                Return _moderator
			End Get
			Set
                _moderator = Value
			End Set
		End Property


		Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
			' Put user code to initialize the page here

			Try
				grpID = Convert.ToInt32(Request.Params(Constants.GROUP_PARAM))
			Catch
				Throw New Exception(Constants.ERROR_MESSAGE_MISSING_PARAMETERS)
			End Try

			grp = Groups.GetGroupByID(grpID)

			tdGroupBulletinLink.Visible = False
			tdGroupBulletinLinkOn.Visible = False
			tdGroupBulletinLabelOn.Visible = False
			tdGroupBlogLink.Visible = False
			tdGroupBlogLinkOn.Visible = False
			tdGroupBlogLabelOn.Visible = False
			tdGMGroupTrashLink.Visible = False
			tdGMGroupTrashLinkOn.Visible = False
			tdGMGroupTrashLabelOn.Visible = False
			trPostBulletin.Visible = False
			trPostBulletinOn.Visible = False
			trPostGroupBlog.Visible = False
			trSpacer.Visible = False

			If grp <> Nothing Then
				hlPostBulletin.NavigateUrl = "../" + Constants.POST_BULLETIN + "?" + Constants.GROUP_PARAM + "=" + grp.ID
				hlPostBulletinOn.NavigateUrl = "../" + Constants.POST_BULLETIN + "?" + Constants.GROUP_PARAM + "=" + grp.ID
				hlGMGroupBulletin.NavigateUrl = "../" + Constants.BULLETIN + "?" + Constants.GROUP_PARAM + "=" + grp.ID
				hlGMGroupBulletinOn.NavigateUrl = hlGMGroupBulletin.NavigateUrl
				hlGMGroupTrash.NavigateUrl = "../" + Constants.TRASH + "?" + Constants.GROUP_PARAM + "=" + grp.ID
				hlGMGroupTrashOn.NavigateUrl = hlGMGroupTrash.NavigateUrl
				hlGMGroupBlog.NavigateUrl = "../" + Constants.BLOG + "?" + Constants.GROUP_PARAM + "=" + grp.ID
				hlPostNewBlog.NavigateUrl = "../" + Constants.SEND_BLOG + "?" + Constants.GROUP_PARAM + "=" + grp.ID
				hlGMGroupBlogOn.NavigateUrl = hlGMGroupBlog.NavigateUrl
				'hlConfirmFriends.Text = "&lt; Back to&nbsp;" + grp.Name;
				'hlConfirmFriends.NavigateUrl = "../" + Constants.GROUP + "?" + Constants.GROUP_PARAM + "=" + grp.ID;
				hlConfirmFriends.Visible = False

				Select Case pageName
					Case Constants.BLOG
						tdGroupBlogLabelOn.Visible = True
						tdGroupBulletinLink.Visible = True
						tdGMGroupTrashLink.Visible = True
						trPostGroupBlog.Visible = IIf(moderator,True,False)
						'true;
						trSpacer.Visible = True
						Exit Select
					Case Constants.BULLETIN
						tdGroupBulletinLabelOn.Visible = True
						tdGroupBlogLink.Visible = True
						tdGMGroupTrashLink.Visible = True
						trPostBulletin.Visible = True
						trSpacer.Visible = True
						Exit Select
					Case Constants.MESSAGES_TRASH_PAGE
						tdGroupBulletinLink.Visible = True
						tdGroupBlogLink.Visible = True
						tdGMGroupTrashLabelOn.Visible = True
						Exit Select
					Case Constants.POST_BLOG_COMMENT
						tdGroupBulletinLink.Visible = True
						tdGroupBlogLinkOn.Visible = True
						tdGMGroupTrashLink.Visible = True
						Exit Select
					Case Constants.SEND_BLOG
						tdGroupBulletinLink.Visible = True
						tdGroupBlogLinkOn.Visible = True
						tdGMGroupTrashLink.Visible = True
						Exit Select
					Case Constants.VIEW_BLOG_COMMENTS
						tdGroupBulletinLink.Visible = True
						tdGroupBlogLinkOn.Visible = True
						tdGMGroupTrashLink.Visible = True
						Exit Select
					Case Constants.POST_BULLETIN
						tdGroupBulletinLinkOn.Visible = True
						tdGroupBlogLink.Visible = True
						tdGMGroupTrashLink.Visible = True
						trPostBulletin.Visible = False
						trPostBulletinOn.Visible = False
						trPostGroupBlog.Visible = False
						trSpacer.Visible = False
						Exit Select
					Case Constants.VIEW_MESSAGE
						Select Case ActiveTab
							Case 1
								tdGroupBulletinLinkOn.Visible = True
								tdGroupBlogLink.Visible = True
								tdGMGroupTrashLink.Visible = True
								Exit Select
							Case 2
								tdGroupBlogLinkOn.Visible = True
								tdGroupBulletinLink.Visible = True
								tdGMGroupTrashLink.Visible = True
								Exit Select
							Case 3
								tdGroupBulletinLink.Visible = True
								tdGroupBlogLink.Visible = True
								tdGMGroupTrashLinkOn.Visible = True
								Exit Select
							Case Else
								tdGroupBulletinLink.Visible = True
								tdGroupBlogLink.Visible = True
								tdGMGroupTrashLink.Visible = True
								Exit Select

						End Select
						Exit Select
					Case Else
						tdGroupBulletinLink.Visible = True
						tdGroupBlogLink.Visible = True
						tdGMGroupTrashLink.Visible = True
						Exit Select
				End Select
			End If
		End Sub

		#region Web Form Designer generated code
		Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
			'
			' CODEGEN: This call is required by the ASP.NET Web Form Designer.
			'
			InitializeComponent()
			MyBase.OnInit(e)
		End Sub

		''' <summary>
		'''		Required method for Designer support - do not modify
		'''		the contents of this method with the code editor.
		''' </summary>
		Private Sub InitializeComponent()
		End Sub
#End Region
	End Class
End Namespace






